'use strict';

const Personnel = require("./personnel");

module.exports = app => {
    const { STRING, INTEGER, DATE } = app.Sequelize;

    const Qualification = app.model.define('qualification', {
        id: { type: INTEGER, primaryKey: true, autoIncrement: true },
        pid: { type: INTEGER },
        uid: STRING,
        structure: STRING,
        standard: INTEGER,
        qmsTime: STRING,
        qualification: STRING,
        registNum: STRING,
        startTime: STRING,
        endTime: STRING,
        leadType: INTEGER,
        witness: STRING,
        suspension: INTEGER,
        remark: STRING,
    });

    Qualification.associate = function () {
        app.model.Qualification.belongsTo(app.model.Personnel, {
            targetKey: 'id',
            foreignKey: 'pid',
        })
    }

    return Qualification;
};